# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=htexploit
pkgver=0.77
pkgrel=9
groups=('blackarch' 'blackarch-exploitation')
pkgdesc='A Python script that exploits a weakness in the way that .htaccess files can be configured to protect a web directory with an authentication process.'
url='http://www.mkit.com.ar/labs/htexploit/'
license=('GPL3')
arch=('any')
depends=('python2')
source=("http://www.mkit.com.ar/labs/htexploit/source/$pkgname-$pkgver.tar.gz")
sha512sums=('26542c3f3f2ef6d7f8570c543a22c6acd95cff12c460a158c11dc089d11397b77568f9793a57bb6d26754f3ce3d5dd4f4a2d5a44a07df33c4272d349bed205cb')

prepare(){
  cd "$pkgname-$pkgver"

  sed -i 's|res/FullList|/usr/share/htexploit/res/FullList|' htexploit
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec python2 /usr/share/$pkgname/$pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

